
/*
'===============================================================================
'  Generated From - CSharp_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  ** 
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class SqlClientEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'abstract' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  public class YourObject :  _YourObject
'  {
'
'  }
'
'===============================================================================
*/

// Generated by MyGeneration Version # (1.3.0.3)

using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.Collections.Specialized;

using MyGeneration.dOOdads;

namespace ShopOnline.DAL
{
	public abstract class _BCCard : SqlClientEntity
	{
		public _BCCard()
		{
			this.QuerySource = "BCCard";
			this.MappingName = "BCCard";

		}	

		//=================================================================
		//  public Overrides void AddNew()
		//=================================================================
		//
		//=================================================================
		public override void AddNew()
		{
			base.AddNew();
			
		}
		
		
		public override void FlushData()
		{
			this._whereClause = null;
			this._aggregateClause = null;
			base.FlushData();
		}
		
		//=================================================================
		//  	public Function LoadAll() As Boolean
		//=================================================================
		//  Loads all of the records in the database, and sets the currentRow to the first row
		//=================================================================
		public bool LoadAll() 
		{
			ListDictionary parameters = null;
			
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_BCCardLoadAll]", parameters);
		}
	
		//=================================================================
		// public Overridable Function LoadByPrimaryKey()  As Boolean
		//=================================================================
		//  Loads a single row of via the primary key
		//=================================================================
		public virtual bool LoadByPrimaryKey(int ID)
		{
			ListDictionary parameters = new ListDictionary();
			parameters.Add(Parameters.ID, ID);

		
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_BCCardLoadByPrimaryKey]", parameters);
		}
		
		#region Parameters
		protected class Parameters
		{
			
			public static SqlParameter ID
			{
				get
				{
					return new SqlParameter("@ID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter FrontCardID
			{
				get
				{
					return new SqlParameter("@FrontCardID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter BackCardID
			{
				get
				{
					return new SqlParameter("@BackCardID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter BorderType
			{
				get
				{
					return new SqlParameter("@BorderType", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter IsTemplate
			{
				get
				{
					return new SqlParameter("@IsTemplate", SqlDbType.Bit, 0);
				}
			}
			
			public static SqlParameter CustomerID
			{
				get
				{
					return new SqlParameter("@CustomerID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter StatusID
			{
				get
				{
					return new SqlParameter("@StatusID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter CreatedDate
			{
				get
				{
					return new SqlParameter("@CreatedDate", SqlDbType.DateTime, 0);
				}
			}
			
			public static SqlParameter CreatedByUser
			{
				get
				{
					return new SqlParameter("@CreatedByUser", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter LastModifiedDate
			{
				get
				{
					return new SqlParameter("@LastModifiedDate", SqlDbType.DateTime, 0);
				}
			}
			
			public static SqlParameter LastModifiedByUser
			{
				get
				{
					return new SqlParameter("@LastModifiedByUser", SqlDbType.Int, 0);
				}
			}
			
		}
		#endregion		
	
		#region ColumnNames
		public class ColumnNames
		{  
            public const string ID = "ID";
            public const string FrontCardID = "FrontCardID";
            public const string BackCardID = "BackCardID";
            public const string BorderType = "BorderType";
            public const string IsTemplate = "IsTemplate";
            public const string CustomerID = "CustomerID";
            public const string StatusID = "StatusID";
            public const string CreatedDate = "CreatedDate";
            public const string CreatedByUser = "CreatedByUser";
            public const string LastModifiedDate = "LastModifiedDate";
            public const string LastModifiedByUser = "LastModifiedByUser";

			static public string ToPropertyName(string columnName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[ID] = _BCCard.PropertyNames.ID;
					ht[FrontCardID] = _BCCard.PropertyNames.FrontCardID;
					ht[BackCardID] = _BCCard.PropertyNames.BackCardID;
					ht[BorderType] = _BCCard.PropertyNames.BorderType;
					ht[IsTemplate] = _BCCard.PropertyNames.IsTemplate;
					ht[CustomerID] = _BCCard.PropertyNames.CustomerID;
					ht[StatusID] = _BCCard.PropertyNames.StatusID;
					ht[CreatedDate] = _BCCard.PropertyNames.CreatedDate;
					ht[CreatedByUser] = _BCCard.PropertyNames.CreatedByUser;
					ht[LastModifiedDate] = _BCCard.PropertyNames.LastModifiedDate;
					ht[LastModifiedByUser] = _BCCard.PropertyNames.LastModifiedByUser;

				}
				return (string)ht[columnName];
			}

			static private Hashtable ht = null;			 
		}
		#endregion
		
		#region PropertyNames
		public class PropertyNames
		{  
            public const string ID = "ID";
            public const string FrontCardID = "FrontCardID";
            public const string BackCardID = "BackCardID";
            public const string BorderType = "BorderType";
            public const string IsTemplate = "IsTemplate";
            public const string CustomerID = "CustomerID";
            public const string StatusID = "StatusID";
            public const string CreatedDate = "CreatedDate";
            public const string CreatedByUser = "CreatedByUser";
            public const string LastModifiedDate = "LastModifiedDate";
            public const string LastModifiedByUser = "LastModifiedByUser";

			static public string ToColumnName(string propertyName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[ID] = _BCCard.ColumnNames.ID;
					ht[FrontCardID] = _BCCard.ColumnNames.FrontCardID;
					ht[BackCardID] = _BCCard.ColumnNames.BackCardID;
					ht[BorderType] = _BCCard.ColumnNames.BorderType;
					ht[IsTemplate] = _BCCard.ColumnNames.IsTemplate;
					ht[CustomerID] = _BCCard.ColumnNames.CustomerID;
					ht[StatusID] = _BCCard.ColumnNames.StatusID;
					ht[CreatedDate] = _BCCard.ColumnNames.CreatedDate;
					ht[CreatedByUser] = _BCCard.ColumnNames.CreatedByUser;
					ht[LastModifiedDate] = _BCCard.ColumnNames.LastModifiedDate;
					ht[LastModifiedByUser] = _BCCard.ColumnNames.LastModifiedByUser;

				}
				return (string)ht[propertyName];
			}

			static private Hashtable ht = null;			 
		}			 
		#endregion	

		#region StringPropertyNames
		public class StringPropertyNames
		{  
            public const string ID = "s_ID";
            public const string FrontCardID = "s_FrontCardID";
            public const string BackCardID = "s_BackCardID";
            public const string BorderType = "s_BorderType";
            public const string IsTemplate = "s_IsTemplate";
            public const string CustomerID = "s_CustomerID";
            public const string StatusID = "s_StatusID";
            public const string CreatedDate = "s_CreatedDate";
            public const string CreatedByUser = "s_CreatedByUser";
            public const string LastModifiedDate = "s_LastModifiedDate";
            public const string LastModifiedByUser = "s_LastModifiedByUser";

		}
		#endregion		
		
		#region Properties
	
		public virtual int ID
	    {
			get
	        {
				return base.Getint(ColumnNames.ID);
			}
			set
	        {
				base.Setint(ColumnNames.ID, value);
			}
		}

		public virtual int FrontCardID
	    {
			get
	        {
				return base.Getint(ColumnNames.FrontCardID);
			}
			set
	        {
				base.Setint(ColumnNames.FrontCardID, value);
			}
		}

		public virtual int BackCardID
	    {
			get
	        {
				return base.Getint(ColumnNames.BackCardID);
			}
			set
	        {
				base.Setint(ColumnNames.BackCardID, value);
			}
		}

		public virtual int BorderType
	    {
			get
	        {
				return base.Getint(ColumnNames.BorderType);
			}
			set
	        {
				base.Setint(ColumnNames.BorderType, value);
			}
		}

		public virtual bool IsTemplate
	    {
			get
	        {
				return base.Getbool(ColumnNames.IsTemplate);
			}
			set
	        {
				base.Setbool(ColumnNames.IsTemplate, value);
			}
		}

		public virtual int CustomerID
	    {
			get
	        {
				return base.Getint(ColumnNames.CustomerID);
			}
			set
	        {
				base.Setint(ColumnNames.CustomerID, value);
			}
		}

		public virtual int StatusID
	    {
			get
	        {
				return base.Getint(ColumnNames.StatusID);
			}
			set
	        {
				base.Setint(ColumnNames.StatusID, value);
			}
		}

		public virtual DateTime CreatedDate
	    {
			get
	        {
				return base.GetDateTime(ColumnNames.CreatedDate);
			}
			set
	        {
				base.SetDateTime(ColumnNames.CreatedDate, value);
			}
		}

		public virtual int CreatedByUser
	    {
			get
	        {
				return base.Getint(ColumnNames.CreatedByUser);
			}
			set
	        {
				base.Setint(ColumnNames.CreatedByUser, value);
			}
		}

		public virtual DateTime LastModifiedDate
	    {
			get
	        {
				return base.GetDateTime(ColumnNames.LastModifiedDate);
			}
			set
	        {
				base.SetDateTime(ColumnNames.LastModifiedDate, value);
			}
		}

		public virtual int LastModifiedByUser
	    {
			get
	        {
				return base.Getint(ColumnNames.LastModifiedByUser);
			}
			set
	        {
				base.Setint(ColumnNames.LastModifiedByUser, value);
			}
		}


		#endregion
		
		#region String Properties
	
		public virtual string s_ID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ID) ? string.Empty : base.GetintAsString(ColumnNames.ID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ID);
				else
					this.ID = base.SetintAsString(ColumnNames.ID, value);
			}
		}

		public virtual string s_FrontCardID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.FrontCardID) ? string.Empty : base.GetintAsString(ColumnNames.FrontCardID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.FrontCardID);
				else
					this.FrontCardID = base.SetintAsString(ColumnNames.FrontCardID, value);
			}
		}

		public virtual string s_BackCardID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.BackCardID) ? string.Empty : base.GetintAsString(ColumnNames.BackCardID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.BackCardID);
				else
					this.BackCardID = base.SetintAsString(ColumnNames.BackCardID, value);
			}
		}

		public virtual string s_BorderType
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.BorderType) ? string.Empty : base.GetintAsString(ColumnNames.BorderType);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.BorderType);
				else
					this.BorderType = base.SetintAsString(ColumnNames.BorderType, value);
			}
		}

		public virtual string s_IsTemplate
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.IsTemplate) ? string.Empty : base.GetboolAsString(ColumnNames.IsTemplate);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.IsTemplate);
				else
					this.IsTemplate = base.SetboolAsString(ColumnNames.IsTemplate, value);
			}
		}

		public virtual string s_CustomerID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.CustomerID) ? string.Empty : base.GetintAsString(ColumnNames.CustomerID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.CustomerID);
				else
					this.CustomerID = base.SetintAsString(ColumnNames.CustomerID, value);
			}
		}

		public virtual string s_StatusID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.StatusID) ? string.Empty : base.GetintAsString(ColumnNames.StatusID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.StatusID);
				else
					this.StatusID = base.SetintAsString(ColumnNames.StatusID, value);
			}
		}

		public virtual string s_CreatedDate
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.CreatedDate) ? string.Empty : base.GetDateTimeAsString(ColumnNames.CreatedDate);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.CreatedDate);
				else
					this.CreatedDate = base.SetDateTimeAsString(ColumnNames.CreatedDate, value);
			}
		}

		public virtual string s_CreatedByUser
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.CreatedByUser) ? string.Empty : base.GetintAsString(ColumnNames.CreatedByUser);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.CreatedByUser);
				else
					this.CreatedByUser = base.SetintAsString(ColumnNames.CreatedByUser, value);
			}
		}

		public virtual string s_LastModifiedDate
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.LastModifiedDate) ? string.Empty : base.GetDateTimeAsString(ColumnNames.LastModifiedDate);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.LastModifiedDate);
				else
					this.LastModifiedDate = base.SetDateTimeAsString(ColumnNames.LastModifiedDate, value);
			}
		}

		public virtual string s_LastModifiedByUser
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.LastModifiedByUser) ? string.Empty : base.GetintAsString(ColumnNames.LastModifiedByUser);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.LastModifiedByUser);
				else
					this.LastModifiedByUser = base.SetintAsString(ColumnNames.LastModifiedByUser, value);
			}
		}


		#endregion		
	
		#region Where Clause
		public class WhereClause
		{
			public WhereClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffWhereParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffWhereParameter(this);
					}

					return _tearOff;
				}
			}

			#region WhereParameter TearOff's
			public class TearOffWhereParameter
			{
				public TearOffWhereParameter(WhereClause clause)
				{
					this._clause = clause;
				}
				
				
				public WhereParameter ID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ID, Parameters.ID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter FrontCardID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.FrontCardID, Parameters.FrontCardID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter BackCardID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.BackCardID, Parameters.BackCardID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter BorderType
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.BorderType, Parameters.BorderType);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter IsTemplate
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.IsTemplate, Parameters.IsTemplate);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter CustomerID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.CustomerID, Parameters.CustomerID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter StatusID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.StatusID, Parameters.StatusID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter CreatedDate
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.CreatedDate, Parameters.CreatedDate);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter CreatedByUser
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.CreatedByUser, Parameters.CreatedByUser);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter LastModifiedDate
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.LastModifiedDate, Parameters.LastModifiedDate);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter LastModifiedByUser
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.LastModifiedByUser, Parameters.LastModifiedByUser);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}


				private WhereClause _clause;
			}
			#endregion
		
			public WhereParameter ID
		    {
				get
		        {
					if(_ID_W == null)
	        	    {
						_ID_W = TearOff.ID;
					}
					return _ID_W;
				}
			}

			public WhereParameter FrontCardID
		    {
				get
		        {
					if(_FrontCardID_W == null)
	        	    {
						_FrontCardID_W = TearOff.FrontCardID;
					}
					return _FrontCardID_W;
				}
			}

			public WhereParameter BackCardID
		    {
				get
		        {
					if(_BackCardID_W == null)
	        	    {
						_BackCardID_W = TearOff.BackCardID;
					}
					return _BackCardID_W;
				}
			}

			public WhereParameter BorderType
		    {
				get
		        {
					if(_BorderType_W == null)
	        	    {
						_BorderType_W = TearOff.BorderType;
					}
					return _BorderType_W;
				}
			}

			public WhereParameter IsTemplate
		    {
				get
		        {
					if(_IsTemplate_W == null)
	        	    {
						_IsTemplate_W = TearOff.IsTemplate;
					}
					return _IsTemplate_W;
				}
			}

			public WhereParameter CustomerID
		    {
				get
		        {
					if(_CustomerID_W == null)
	        	    {
						_CustomerID_W = TearOff.CustomerID;
					}
					return _CustomerID_W;
				}
			}

			public WhereParameter StatusID
		    {
				get
		        {
					if(_StatusID_W == null)
	        	    {
						_StatusID_W = TearOff.StatusID;
					}
					return _StatusID_W;
				}
			}

			public WhereParameter CreatedDate
		    {
				get
		        {
					if(_CreatedDate_W == null)
	        	    {
						_CreatedDate_W = TearOff.CreatedDate;
					}
					return _CreatedDate_W;
				}
			}

			public WhereParameter CreatedByUser
		    {
				get
		        {
					if(_CreatedByUser_W == null)
	        	    {
						_CreatedByUser_W = TearOff.CreatedByUser;
					}
					return _CreatedByUser_W;
				}
			}

			public WhereParameter LastModifiedDate
		    {
				get
		        {
					if(_LastModifiedDate_W == null)
	        	    {
						_LastModifiedDate_W = TearOff.LastModifiedDate;
					}
					return _LastModifiedDate_W;
				}
			}

			public WhereParameter LastModifiedByUser
		    {
				get
		        {
					if(_LastModifiedByUser_W == null)
	        	    {
						_LastModifiedByUser_W = TearOff.LastModifiedByUser;
					}
					return _LastModifiedByUser_W;
				}
			}

			private WhereParameter _ID_W = null;
			private WhereParameter _FrontCardID_W = null;
			private WhereParameter _BackCardID_W = null;
			private WhereParameter _BorderType_W = null;
			private WhereParameter _IsTemplate_W = null;
			private WhereParameter _CustomerID_W = null;
			private WhereParameter _StatusID_W = null;
			private WhereParameter _CreatedDate_W = null;
			private WhereParameter _CreatedByUser_W = null;
			private WhereParameter _LastModifiedDate_W = null;
			private WhereParameter _LastModifiedByUser_W = null;

			public void WhereClauseReset()
			{
				_ID_W = null;
				_FrontCardID_W = null;
				_BackCardID_W = null;
				_BorderType_W = null;
				_IsTemplate_W = null;
				_CustomerID_W = null;
				_StatusID_W = null;
				_CreatedDate_W = null;
				_CreatedByUser_W = null;
				_LastModifiedDate_W = null;
				_LastModifiedByUser_W = null;

				this._entity.Query.FlushWhereParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffWhereParameter _tearOff;
			
		}
	
		public WhereClause Where
		{
			get
			{
				if(_whereClause == null)
				{
					_whereClause = new WhereClause(this);
				}
		
				return _whereClause;
			}
		}
		
		private WhereClause _whereClause = null;	
		#endregion
	
		#region Aggregate Clause
		public class AggregateClause
		{
			public AggregateClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffAggregateParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffAggregateParameter(this);
					}

					return _tearOff;
				}
			}

			#region AggregateParameter TearOff's
			public class TearOffAggregateParameter
			{
				public TearOffAggregateParameter(AggregateClause clause)
				{
					this._clause = clause;
				}
				
				
				public AggregateParameter ID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ID, Parameters.ID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter FrontCardID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.FrontCardID, Parameters.FrontCardID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter BackCardID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.BackCardID, Parameters.BackCardID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter BorderType
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.BorderType, Parameters.BorderType);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter IsTemplate
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.IsTemplate, Parameters.IsTemplate);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter CustomerID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.CustomerID, Parameters.CustomerID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter StatusID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.StatusID, Parameters.StatusID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter CreatedDate
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.CreatedDate, Parameters.CreatedDate);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter CreatedByUser
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.CreatedByUser, Parameters.CreatedByUser);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter LastModifiedDate
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.LastModifiedDate, Parameters.LastModifiedDate);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter LastModifiedByUser
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.LastModifiedByUser, Parameters.LastModifiedByUser);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}


				private AggregateClause _clause;
			}
			#endregion
		
			public AggregateParameter ID
		    {
				get
		        {
					if(_ID_W == null)
	        	    {
						_ID_W = TearOff.ID;
					}
					return _ID_W;
				}
			}

			public AggregateParameter FrontCardID
		    {
				get
		        {
					if(_FrontCardID_W == null)
	        	    {
						_FrontCardID_W = TearOff.FrontCardID;
					}
					return _FrontCardID_W;
				}
			}

			public AggregateParameter BackCardID
		    {
				get
		        {
					if(_BackCardID_W == null)
	        	    {
						_BackCardID_W = TearOff.BackCardID;
					}
					return _BackCardID_W;
				}
			}

			public AggregateParameter BorderType
		    {
				get
		        {
					if(_BorderType_W == null)
	        	    {
						_BorderType_W = TearOff.BorderType;
					}
					return _BorderType_W;
				}
			}

			public AggregateParameter IsTemplate
		    {
				get
		        {
					if(_IsTemplate_W == null)
	        	    {
						_IsTemplate_W = TearOff.IsTemplate;
					}
					return _IsTemplate_W;
				}
			}

			public AggregateParameter CustomerID
		    {
				get
		        {
					if(_CustomerID_W == null)
	        	    {
						_CustomerID_W = TearOff.CustomerID;
					}
					return _CustomerID_W;
				}
			}

			public AggregateParameter StatusID
		    {
				get
		        {
					if(_StatusID_W == null)
	        	    {
						_StatusID_W = TearOff.StatusID;
					}
					return _StatusID_W;
				}
			}

			public AggregateParameter CreatedDate
		    {
				get
		        {
					if(_CreatedDate_W == null)
	        	    {
						_CreatedDate_W = TearOff.CreatedDate;
					}
					return _CreatedDate_W;
				}
			}

			public AggregateParameter CreatedByUser
		    {
				get
		        {
					if(_CreatedByUser_W == null)
	        	    {
						_CreatedByUser_W = TearOff.CreatedByUser;
					}
					return _CreatedByUser_W;
				}
			}

			public AggregateParameter LastModifiedDate
		    {
				get
		        {
					if(_LastModifiedDate_W == null)
	        	    {
						_LastModifiedDate_W = TearOff.LastModifiedDate;
					}
					return _LastModifiedDate_W;
				}
			}

			public AggregateParameter LastModifiedByUser
		    {
				get
		        {
					if(_LastModifiedByUser_W == null)
	        	    {
						_LastModifiedByUser_W = TearOff.LastModifiedByUser;
					}
					return _LastModifiedByUser_W;
				}
			}

			private AggregateParameter _ID_W = null;
			private AggregateParameter _FrontCardID_W = null;
			private AggregateParameter _BackCardID_W = null;
			private AggregateParameter _BorderType_W = null;
			private AggregateParameter _IsTemplate_W = null;
			private AggregateParameter _CustomerID_W = null;
			private AggregateParameter _StatusID_W = null;
			private AggregateParameter _CreatedDate_W = null;
			private AggregateParameter _CreatedByUser_W = null;
			private AggregateParameter _LastModifiedDate_W = null;
			private AggregateParameter _LastModifiedByUser_W = null;

			public void AggregateClauseReset()
			{
				_ID_W = null;
				_FrontCardID_W = null;
				_BackCardID_W = null;
				_BorderType_W = null;
				_IsTemplate_W = null;
				_CustomerID_W = null;
				_StatusID_W = null;
				_CreatedDate_W = null;
				_CreatedByUser_W = null;
				_LastModifiedDate_W = null;
				_LastModifiedByUser_W = null;

				this._entity.Query.FlushAggregateParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffAggregateParameter _tearOff;
			
		}
	
		public AggregateClause Aggregate
		{
			get
			{
				if(_aggregateClause == null)
				{
					_aggregateClause = new AggregateClause(this);
				}
		
				return _aggregateClause;
			}
		}
		
		private AggregateClause _aggregateClause = null;	
		#endregion
	
		protected override IDbCommand GetInsertCommand() 
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_BCCardInsert]";
	
			CreateParameters(cmd);
			
			SqlParameter p;
			p = cmd.Parameters[Parameters.ID.ParameterName];
			p.Direction = ParameterDirection.Output;
    
			return cmd;
		}
	
		protected override IDbCommand GetUpdateCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_BCCardUpdate]";
	
			CreateParameters(cmd);
			      
			return cmd;
		}
	
		protected override IDbCommand GetDeleteCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_BCCardDelete]";
	
			SqlParameter p;
			p = cmd.Parameters.Add(Parameters.ID);
			p.SourceColumn = ColumnNames.ID;
			p.SourceVersion = DataRowVersion.Current;

  
			return cmd;
		}
		
		private IDbCommand CreateParameters(SqlCommand cmd)
		{
			SqlParameter p;
		
			p = cmd.Parameters.Add(Parameters.ID);
			p.SourceColumn = ColumnNames.ID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.FrontCardID);
			p.SourceColumn = ColumnNames.FrontCardID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.BackCardID);
			p.SourceColumn = ColumnNames.BackCardID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.BorderType);
			p.SourceColumn = ColumnNames.BorderType;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.IsTemplate);
			p.SourceColumn = ColumnNames.IsTemplate;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.CustomerID);
			p.SourceColumn = ColumnNames.CustomerID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.StatusID);
			p.SourceColumn = ColumnNames.StatusID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.CreatedDate);
			p.SourceColumn = ColumnNames.CreatedDate;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.CreatedByUser);
			p.SourceColumn = ColumnNames.CreatedByUser;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.LastModifiedDate);
			p.SourceColumn = ColumnNames.LastModifiedDate;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.LastModifiedByUser);
			p.SourceColumn = ColumnNames.LastModifiedByUser;
			p.SourceVersion = DataRowVersion.Current;


			return cmd;
		}
	}
}
